/*
 *  Copyright 2001-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package ar.uba.fi.posgrado.academy.web.form.teacher;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.util.LabelValueBean;

import ar.uba.fi.posgrado.academy.model.Teacher;

/**
 * Form para {@link Teacher docentes}
 * 
 * @author ariel.piechotka
 */
@SuppressWarnings("serial")
public class TeacherForm extends ActionForm {

	private Long id;

	private String fileNumber;

	private String name;

	private Long idBody;

	private String degree;

	private String cv;

	private String personalId;

	private String taxId;

	private List<LabelValueBean> bodyOptions = new ArrayList<LabelValueBean>();

	private List<Teacher> teachers = new ArrayList<Teacher>();

	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors actionErrors = new ActionErrors();

		if (idBody == null || idBody.equals(0l))
            actionErrors.add("teacher.body", new ActionMessage("teacher.body.empty"));

		return actionErrors;
	}

	public String getFileNumber() {
		return fileNumber;
	}

	public void setFileNumber(String fileNumber) {
		this.fileNumber = fileNumber;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Teacher> getTeachers() {
		return teachers;
	}

	public void setTeachers(List<Teacher> teachers) {
		this.teachers = teachers;
	}

	public void clear() {
		id = null;
		name = "";
		fileNumber = "";
		idBody = null;
		cv = "";
		degree = "";
		personalId = "";
		taxId = "";
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<LabelValueBean> getBodyOptions() {
		return bodyOptions;
	}

	public void setBodyOptions(List<LabelValueBean> bodyOptions) {
		this.bodyOptions = bodyOptions;
	}

	public Long getIdBody() {
		return idBody;
	}

	public void setIdBody(Long bodyId) {
		this.idBody = bodyId;
	}

	public String getCv() {
		return cv;
	}

	public void setCv(String cv) {
		this.cv = cv;
	}

	public String getDegree() {
		return degree;
	}

	public void setDegree(String degree) {
		this.degree = degree;
	}

	public String getPersonalId() {
		return personalId;
	}

	public void setPersonalId(String personalId) {
		this.personalId = personalId;
	}

	public String getTaxId() {
		return taxId;
	}

	public void setTaxId(String taxId) {
		this.taxId = taxId;
	}
}
